@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Quicksand:wght@500&display=swap');

body {
font-family: 'Quicksand',         sans-serif;
text-align: justify
}

h2 {
    font-family: 'Fredoka One', cursive;
    background-color: #24252A;
    color: #FAE2B8;
    padding: 15px;
    text-align: left
}

My meme

My meme features my pigs, Winifred and Dorothy, with the aim of making Anna smile (or groan as the puns are bad); the puns were sourced from the internet, the photos are original.

Punny Pigs

# PROJECT 1 MEME

library(magick)

# Winifred :)

winifred <- image_read(path = "Winifred.jpg") %>%
  image_scale("400")

#get accurate size of pic so can get border right

image_info(winifred) 

# colour 24252A picked to match Winifred's snout (via eye dropper tool)
# colour FAE2B8 match bristles by her eye

#box with text

box <- image_blank(width = 400, 
                   height = 361, 
                   color = "#24252A") %>%
  image_annotate("Wait for it...", 
                 color = "#FAE2B8", 
                 size = 40, 
                 font = "Comic Sans",
                 gravity = "center")

# adding text over winifred 

winANDtext <- image_annotate(winifred, "punny pigs", 
                             size = 40,
                             font = "Comic Sans",
                             color = "#6600cc",
                             boxcolor = "#ff00ff",
                             degrees = 323, 
                             location = "+170+300") 

# WinifredSpeech
winifredspeech <- image_read(path = "WinifredSpeech.jpg") %>%
  image_scale("300")

# DorothySpeech
dorothyspeech <- image_read(path = "DorothySpeech.jpg") %>%
  image_scale("300")

#get accurate size of pic so can get side boxes right width

image_info(winifredspeech) 
image_info(dorothyspeech)

# Winifredbox
winifredbox <- image_blank(width = 100, 
                   height = 220, 
                   color = "#24252A")

# Dorothybox
dorothybox <- image_blank(width = 100, 
                           height = 194, 
                           color = "#24252A")

# Joke1
winifredjoke1 <- image_annotate(winifredspeech, "What do you call a pig thief?", 
                             size = 10,
                             font = "Comic Sans",
                             color = "black",
                             location = "+160+50")

dorothyjoke1 <- image_annotate(dorothyspeech, "A hamburglar", 
                               size = 10,
                               font = "Comic Sans",
                               color = "black",
                               location = "+16+27")

# Joke2
winifredjoke2 <- image_annotate(winifredspeech, "What do you get when you\npick a pig's nose?", 
                                size = 10,
                                font = "Comic Sans",
                                color = "black",
                                location = "+170+45")

dorothyjoke2 <- image_annotate(dorothyspeech, "Ham boogers", 
                               size = 10,
                               font = "Comic Sans",
                               color = "black",
                               location = "+16+27")

# making each row
winrow1 <- image_append(c(winifredjoke1, winifredbox))
dorrow1 <- image_append(c(dorothybox, dorothyjoke1))
winrow2 <- image_append(c(winifredjoke2, winifredbox))
dorrow2 <- image_append(c(dorothybox, dorothyjoke2))


# putting together with box, winANDtext, winrow1, dorrow1, winrow2, dorrrow2
# adding a border

  winfin <- c(box, winANDtext, winrow1, dorrow1, winrow2, dorrow2) %>%
  image_append(stack = TRUE) %>%
  image_border("#FAE2B8","20x20")

winfin

# saving file
image_write(winfin, "my_meme.png")

My animated GIF

My animated GIF was really another excuse to showcase my animals, inspired by the Sesame Street classic “One of these things doesn’t belong” (please sing the song in your head as you’re watching the animated GIF).

One of these things doesn’t belong

library(magick)
# creating animated GIF

# getting images (check sizing, could do text in here instead...)

text <- image_read(path = "text.jpg") %>%
  image_scale("200")

daisy <- image_read(path = "Daisy.jpg")%>%
  image_scale("150")

binky <- image_read(path = "Binky.jpg") %>%
  image_scale("150")

wilbur <- image_read(path = "Wilbur.jpg") %>%
  image_scale("150")

cornelius <- image_read(path = "Cornelius.jpg") %>%
  image_scale("150")

# creating each frame
frame1box <- image_blank(color = "#f2e6ff",
                        width = 250,
                      height = 250)
frame1 <- image_composite(frame1box, 
                          text, 
                          operator = "atop",
                          offset = "+0+0",
                          gravity = "center")

frame2box <- image_blank(color = "#e6f2ff",
                         width = 250,
                         height = 250)
frame2 <- image_composite(frame2box, 
                          daisy, 
                          operator = "atop",
                          offset = "+0+0",
                          gravity = "center")

frame3 <- image_composite(frame2box, 
                          binky, 
                          operator = "atop",
                          offset = "+0+0",
                          gravity = "center")

frame4 <- image_composite(frame2box, 
                          wilbur, 
                          operator = "atop",
                          offset = "+0+0",
                          gravity = "center")

frame5 <- image_composite(frame2box, 
                          cornelius, 
                          operator = "atop",
                          offset = "+0+0",
                          gravity = "center")

poss_frames <- c(frame2, frame3, frame4, frame5)
poss_order1 <- sample(poss_frames)
poss_order2 <- sample(poss_frames)
poss_order3 <- sample(poss_frames)
poss_order4 <- sample(poss_frames)
poss_order5 <- sample(poss_frames)

frames <- c(frame1, frame1, poss_order1, 
            frame1, frame1, poss_order2, 
            frame1, frame1, poss_order3, 
            frame1, frame1, poss_order4,
            frame1, frame1, poss_order5) %>%
  image_animate(fps = 1) %>%
  image_write("my_animation.gif")